Skip to content

chore: automate releases#3833

Merged
rickeylev merged 5 commits into
bazel-contrib:mainfrom
rickeylev:automate-rules-python-release
Jun 24, 2026
Merged

chore: automate releases#3833
rickeylev merged 5 commits into
bazel-contrib:mainfrom
rickeylev:automate-rules-python-release

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

This introduces workflows and tools to automate releases. The basic
idea it to have an issue with tasks, and workflows invoke tools that
parse and update the tasks in the issue.

The basic release steps are:

  1. Prepare a release (update changelog via PR)
  2. Create a release branch after preparation
  3. Backport changes into the release branch
  4. Tag RCs
  5. Promote to final

Each step has a workflow. For now, most of the workflows require a
manual trigger, to help prevent workflows from running wild as we
flush out bugs and edge cases.

The workflows almost entirely delegate to the release tool. There's
basically one command per workflow. This makes it easy to encode
specialized logic and run it locally for testing or reproduction.

Overhauls the release pipeline into a fully automated, robust, and modular architecture:
- Created utils.py, git.py, and gh.py to encapsulate shell executions, git helpers, and GitHub CLI wrappers under clean, prefix-free module namespaces.
- Overhauled release.py to use these modules, return clean exit codes, and support dynamic RC tagging and checklist gating.
- Overhauled cmd_prepare to make the preparation pipeline fully unconditional (cuts branch, commits, pushes, opens PR, and creates/updates tracking issue).
- Integrated news processing directly into cmd_process_backports to merge and amend changelogs per backport.
- Created GitHub Actions workflows to automate all release phases (prepare, branch cut, backports, RC tagging, and promotion).
- Added comprehensive unit test suites in release_test.py mocking the new module-level namespace helpers.
@rickeylev rickeylev requested a review from aignas as a code owner June 19, 2026 07:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a code-centric, reactive release automation architecture for rules_python by splitting the release logic into dedicated helper modules (gh.py, git.py, utils.py) and expanding release.py with several subcommands to handle preparation, branch cutting, backport processing, and release candidate tagging. Feedback on the changes highlights several critical issues, including the need to use git status --porcelain and .splitlines() to properly parse git output line-by-line rather than character-by-character. Additionally, the reviewer noted a Python compatibility issue with Exception.add_note on older Python versions, unsafe dictionary access on PR merge commits, potential failures when staging a non-existent news/ directory, loose regex patterns for parsing versions from issue titles, and potential regex failures due to Windows-style line endings.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tools/private/release/git.py Outdated
Comment thread tools/private/release/release.py
Comment thread tools/private/release/release.py Outdated
Comment thread tools/private/release/utils.py
Comment thread tools/private/release/gh.py Outdated
Comment thread tools/private/release/release.py
Comment thread tools/private/release/release.py Outdated
Comment thread tools/private/release/release.py Outdated
Comment thread tools/private/release/release.py Outdated
Comment thread tools/private/release/release.py

@aignas aignas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the versions of the GH actions used in here.

Comment thread .github/workflows/process_backports.yml Outdated
Comment thread .github/workflows/cut_release_branch.yml Outdated
This commit addresses the 12 code review comments on the release automation PR.
It fixes the workspace clean checks by using porcelain git status and line splitting,
defensively parses PR merge commits, normalizes line endings, compiles a common and simplified
issue title version regex, and updates GitHub Action workflow versions to their latest aligned state.
This commit upgrades the actions/checkout version to v7 in the newly added
release automation workflow files. It also adds a new project-scoped agent
rule configuration under .agents/rules/ to ensure future workflow file
creation always adopts the latest action versions.
@rickeylev rickeylev added this pull request to the merge queue Jun 24, 2026
Merged via the queue into bazel-contrib:main with commit 4b19581 Jun 24, 2026
4 of 5 checks passed
@rickeylev rickeylev deleted the automate-rules-python-release branch June 24, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants